#Code to produce Figure 1 (conditional violence effects in both studies)

par(mfrow=c(1,2))
### Study 1 (U.S.)

#Costs of violence. NOTE: interaction effects calculated using "contrasts" (see script included in this replication file) and inserted manually here:

costs <- c(-0.64, -0.25, 0.04) #effect of violence among no service, restrictive service, inclusive service groups, respectively
costs

#Upper CI limits:
costs.upper <- matrix(c(-0.27, 0.16, 0.42)) #upper limit of 95% CI for effect of violence among no service, restrictive service, and inclusive service group, respectively
costs.upper

#Lower CI limits:
costs.lower <- matrix(c(-1.00, -0.65, -0.35)) #lower limit of 95% CI for effect of violence among no service, restrictive service, and inclusive service group, respectively
costs.lower

# Create a numeric vector with the number of rows (3)
rowCount <- 1:3

# Create plot:
plot(NULL, xlim = c(0.5,3), ylim=c(-1,1), xlab="", ylab="", axes=F)
 
#Point estimates:
points(x = c(0.8, 1.8, 2.8), y = costs, pch=16, cex=1.5, col="black")
 
#CI bars:
for(x in rowCount) lines(c(x-.2, x-.2), c(costs.upper[x], costs.lower[x]), col="black", lwd = 2)
 
#Axes, title, etc.:
axis(1,seq(0.8,2.8,by=1), lab=c("No\nServices","Restrictive\nServices","Inclusive\nServices"), tick=F, cex.axis=1.1)
axis(2,at=-1:1)
par(new=TRUE)
title("Study 1 (U.S.)", xlab="",
      ylab="Effect of Killing Civilians on Legitimacy", cex.lab=1.3)
abline(h=0, lty=2)
box()
 
### Study 2 (U.K.)

#Costs of violence. NOTE: interaction effects calculated using "contrasts" (see script included in this replication file) and inserted manually here:

costs <- c(-0.42, -0.46, -0.21) #effect of violence among no service, restrictive service, inclusive service groups, respectively
costs

#Upper CI limits:
costs.upper <- matrix(c(-0.06, -0.08, 0.15)) #upper limit of 95% CI for effect of violence among no service, restrictive service, and inclusive service group, respectively
costs.upper

#Lower CI limits:
costs.lower <- matrix(c(-0.78, -0.84, -0.58)) #lower limit of 95% CI for effect of violence among no service, restrictive service, and inclusive service group, respectively
costs.lower

# Create a numeric vector with the number of rows (3)
rowCount <- 1:3
 
# Create plot:
plot(NULL, xlim = c(0.5,3), ylim=c(-1,1), xlab="", ylab="", axes=F)
 
#Point estimates:
points(x = c(0.8, 1.8, 2.8), y = costs, pch=16, cex=1.5, col="black")
 
#CI bars:
for(x in rowCount) lines(c(x-.2, x-.2), c(costs.upper[x], costs.lower[x]), col="black", lwd = 2)
 
#Axes, title, etc.:
axis(1,seq(0.8,2.8,by=1), lab=c("No\nServices","Restrictive\nServices","Inclusive\nServices"), tick=F, , cex.axis=1.1)
axis(2,at=-1:1)
par(new=TRUE)
title("Study 2 (U.K.)", xlab="",
ylab="Effect of Killing Civilians on Legitimacy", cex.lab=1.3)
abline(h=0, lty=2)
box()